//
// Created by Zhangwj on 2023/9/27.
//

#include "ForStmtNode.h"

std::unique_ptr<ForStmtNode> ForStmtNode::ForStmtParser(Parser &parser) {
    // ForStmt → LVal '=' Exp
    std::unique_ptr<ForStmtNode> forStmtNode = std::make_unique<ForStmtNode>();
    forStmtNode->LVal = LValNode::LValParser(parser);
    if (parser.getLexType(0) == LexType::ASSIGN) {
        parser.next();
    }
    forStmtNode->LVal = LValNode::LValParser(parser);
    return forStmtNode;
}
